package cn.rokhdelar.ams.config;

import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;

@Configuration
public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {

    private final DataSource dataSource;

    public FlowableConfig(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    @Override
    public void configure(SpringProcessEngineConfiguration engineConfiguration) {
        engineConfiguration.setDataSource(dataSource);
        engineConfiguration.setDatabaseSchemaUpdate("true");
        engineConfiguration.setAsyncExecutorActivate(false);

        // 设置自定义用户/组服务（可选）
        // engineConfiguration.setIdmIdentityService(new CustomIdmIdentityService());
    }
}